import React from "react";
const R = require('ramda');
import Cookies from 'js-cookie';
import { Modal,Form  } from 'antd';

const FormItem = Form.Item;

export default class MessageDetail extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            open: false
        }
    }
    
    handleOpen = () => {
        this.setState({
            open: true
        })
    }

    handleClose = () => {
        this.setState({
            open: false
        })
        if(this.props.refreshList)this.props.refreshList(null, true);
    }

    render() {
        const formItemLayout = {
            labelCol: { xs: { span: 24 }, sm: { span: 6 } },
            wrapperCol: { xs: { span: 24 }, sm: { span: 14 } },
        };

        return (
            <Modal maskClosable={false} footer={null} visible={this.state.open} title={"消息详情"} width={500} wrapClassName="vertical-center-modal" onCancel={this.handleClose.bind(this)}>
                <Form>
                    <FormItem {...formItemLayout} label="发送人">
                        <div>{"SYSTEM"}</div>
                    </FormItem>
                    <FormItem {...formItemLayout} label="发送日期">
                        <div>{R.isNil(this.props.dataSource.rectime) ? "" : this.props.dataSource.rectime}</div>
                    </FormItem>
                    <FormItem {...formItemLayout} label="标题">
                        <div style={{whiteSpace: 'initial'}}>{R.isNil(this.props.dataSource.title) ? "" : this.props.dataSource.title}</div>
                    </FormItem>
                </Form>
                <div style={{border: '1px solid #e9e9e9', height: 100, width: 300, marginLeft: '20%', lineHeight: 2, whiteSpace: 'initial'}}>{R.isNil(this.props.dataSource.content) ? "" : this.props.dataSource.content}</div>
            </Modal>
        );
    }
}